# Copyright (c) 2025 Huawei Technologies Co., Ltd.
# This program is free software, you can redistribute it and/or modify it under the terms and conditions of
# CANN Open Software License Agreement Version 2.0 (the "License").
# Please refer to the License for details. You may not use this file except in compliance with the License.
# THIS SOFTWARE IS PROVIDED ON AN "AS IS" BASIS, WITHOUT WARRANTIES OF ANY KIND, EITHER EXPRESS OR IMPLIED,
# INCLUDING BUT NOT LIMITED TO NON-INFRINGEMENT, MERCHANTABILITY, OR FITNESS FOR A PARTICULAR PURPOSE.
# See LICENSE in the root of the software repository for the full text of the License.


from .block_sync import (
    data_sync_barrier,
    pipe_barrier,
    set_flag,
    wait_flag,
)
from .common import (
    ascend_is_aic,
    ascend_is_aiv,
    get_hccl_context,
    get_sys_workspace,
    reset_mask,
    set_aipp_functions,
    set_atomic_add,
    set_atomic_max,
    set_atomic_min,
    set_atomic_none,
    set_atomic_type,
    set_hccl_context,
    set_hf32_mode,
    set_hf32_trans_mode,
    set_mask_count,
    set_mask_norm,
    set_mm_layout_transform,
    set_sys_workspace,
    set_vector_mask,
)
from .data_cache import data_cache_clean_and_invalid, get_icache_preload_status, icache_preload
from .data_conversion import transpose, trans_data_to_5hd
from .data_copy import copy, data_copy, data_copy_pad, load_image_to_local
from .dump_tensor import (
    dump_tensor, 
    printf, 
    print_time_stamp, 
    dump_acc_chk_point, 
    metrics_prof_start, 
    metrics_prof_stop,
)
from .scalar import scalar_cast, scalar_get_sff_value
from .sys_var import (
    get_arch_version,
    get_block_idx,
    get_block_num,
    get_data_block_size_in_bytes,
    get_sub_block_num,
    get_program_counter,
    get_system_cycle,
    trap,
)
from .vec_binary import (
    add,
    add_deq_relu,
    add_relu,
    bilinear_interpolation,
    bitwise_and,
    bitwise_or,
    div,
    fused_mul_add,
    fused_mul_add_relu,
    max,
    min,
    mul,
    mul_add_dst,
    mul_cast,
    sub,
    sub_relu,
)
from .vec_binary_scalar import (
    adds,
    leaky_relu,
    maxs,
    mins,
    muls,
    shift_left,
    shift_right,
)
from .vec_brcb import brcb
from .vec_duplicate import duplicate
from .vec_gather import (
    gather, 
    gatherb,
)
from .vec_gather_mask import gather_mask, get_gather_mask_remain_count
from .proposal import (
    proposal_concat,
    proposal_extract,
)
from .vec_reduce import (
    block_reduce_sum,
    block_reduce_max,
    block_reduce_min,
    pair_reduce_sum,
    reduce_max,
    reduce_min,
    reduce_sum,
    repeat_reduce_sum,
    whole_reduce_max,
    whole_reduce_min,
    whole_reduce_sum,
)
from .vec_scatter import scatter
from .vec_ternary_scalar import axpy
from .vec_unary import (
    abs,
    exp,
    ln,
    bitwise_not,
    reciprocal,
    relu,
    rsqrt,
    sqrt,
)
from .vec_vconv import (
    add_relu_cast,
    sub_relu_cast,
    set_deq_scale,
    cast_deq,
)

__all__ = [
    # .block_sync
    "data_sync_barrier",
    "pipe_barrier",
    "set_flag",
    "wait_flag",
    # .common
    "ascend_is_aic",
    "ascend_is_aiv",
    "get_hccl_context",
    "get_sys_workspace",
    "reset_mask",
    "set_aipp_functions",
    "set_atomic_add",
    "set_atomic_max",
    "set_atomic_min",
    "set_atomic_none",
    "set_atomic_type",
    "set_hccl_context",
    "set_hf32_mode",
    "set_hf32_trans_mode",
    "set_mask_count",
    "set_mask_norm",
    "set_mm_layout_transform",
    "set_sys_workspace",
    "set_vector_mask",
    # .data_cache
    "data_cache_clean_and_invalid",
    "get_icache_preload_status",
    "icache_preload",
    # .data_conversion
    "transpose",
    "trans_data_to_5hd",
    # .data_copy
    "copy",
    "data_copy",
    "data_copy_pad",
    "load_image_to_local",
    # .dump_tensor
    "dump_tensor",
    "printf",
    "print_time_stamp",
    "dump_acc_chk_point",
    "metrics_prof_start",
    "metrics_prof_stop",
    # .scalar
    "scalar_cast",
    "scalar_get_sff_value",
    # .sys_var
    "get_arch_version",
    "get_block_idx",
    "get_block_num",
    "get_data_block_size_in_bytes",
    "get_sub_block_num",
    "get_program_counter",
    "get_system_cycle",
    "trap",
    # .vec_binary
    "add",
    "add_deq_relu",
    "add_relu",
    "add_relu_cast",
    "bilinear_interpolation",
    "bitwise_and",
    "bitwise_or",
    "div",
    "fused_mul_add",
    "fused_mul_add_relu",
    "gather_mask",
    "get_gather_mask_remain_count",
    "max",
    "min",
    "mul",
    "mul_add_dst",
    "mul_cast",
    "sub",
    "sub_relu",
    "sub_relu_cast",
    # .vec_binary_scalar
    "adds",
    "leaky_relu",
    "maxs",
    "mins",
    "muls",
    "shift_left",
    "shift_right",
    # .vec_brcb
    "brcb",
    # .vec_duplicate
    "duplicate",
    # .vec_gather
    "gather",
    "gatherb",
    # .vec_proposal
    "proposal_concat",
    "proposal_extract",
    # .vec_reduce
    "block_reduce_sum",
    "block_reduce_max",
    "block_reduce_min",
    "pair_reduce_sum",
    "repeat_reduce_sum",
    "whole_reduce_max",
    "whole_reduce_min",
    "whole_reduce_sum",
    "reduce_max",
    "reduce_min",
    "reduce_sum",
    # .vec_scatter
    "scatter",
    # .vec_ternary_scalar
    "axpy",
    # .vec_unary
    "abs",
    "exp",
    "ln",
    "bitwise_not",
    "reciprocal",
    "relu",
    "rsqrt",
    "sqrt",
    # .vec_vconv
    "cast_deq",
    "set_deq_scale",    
]
